package com.fenghongzhang.login.mvp.presenter;

import com.fenghongzhang.lib.mvp.presenter.BasePresenter;
import com.fenghongzhang.login.entity.LoginInfo;
import com.fenghongzhang.login.mvp.contract.LoginContract;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class LoginPresenter extends BasePresenter<LoginContract.ILoginModel,LoginContract.ILoginView> {

    public LoginPresenter(LoginContract.ILoginModel mModel, LoginContract.ILoginView mView) {
        super(mModel, mView);
    }

    public void login(String name){

    }

    public void login(){
        mModel.login(mView.getName(), mView.getPwd(), new Observer<LoginInfo>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(LoginInfo loginInfo) {
                mView.isLoginOk(loginInfo);
            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onComplete() {

            }
        });
    }

}
